{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. autoreload\n",
    "\n",
    "在notebook中如果修改了引用的库的文件, 再次执行自动加载\n",
    "\n",
    "`%load_ext autoreload`\n",
    "\n",
    "`%reload_ext autoreload`\n",
    "\n",
    "| 命令 | 描述 |\n",
    "|:----:|:----:|\n",
    "| `%autoreload` | 自动重载%aimport排除的模块之外的所有模块。\n",
    "| `%autoreload 0` | 禁用自动重载\n",
    "| `%autoreload 1` | 自动重载%aimport指定的模块。\n",
    "| `%autoreload 2` | 自动重载%aimport排除的模块之外的所有模块。\n",
    "| `%aimport` | 列出需要自动重载的模块和不需要重载的模块。\n",
    "| `%aimport foo` | 重载模块foo并将它标记为需要自动重载。\n",
    "| `%aimport -foo` | 将模块foo标记为不需要自动重载。\n",
    "\n",
    "## 常用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. markdown\n",
    "\n",
    "在notebook中markdown使用cell中的变量"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.1 magic command"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "url = \"http://www.baidu.com\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%markdown\n",
    "\n",
    "## [百度]({url})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.2 Markdown function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import Markdown\n",
    "Markdown(\"## [百度](%s)\".format(url))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.3 python-mardown nbextensions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "variables": {
     "url": "<a href=\"http://www.baidu.com\">http://www.baidu.com</a>"
    }
   },
   "source": [
    "## [百度]({{url}})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. tensorboard"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# %reload_ext tensorboard\n",
    "# # set and do something\n",
    "# %tensorboard --host {host_addr} --port {port} --logdir {log_dir}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
